<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
	        $table->increments('id')->comment('商品分类表');
	        $table->string('title', 32)->comment('分类名称')->default('');
	        $table->unsignedInteger('parent_id')->comment('父分类id')->default(0);
	        $table->integer('sort_number')->comment('排序标识')->default(0);
	        $table->string('image', 255)->comment('分类图片')->default('');
	        $table->boolean('is_used')->comment('是否启用')->default(1);
	        $table->unsignedTinyInteger('is_nav')->comment('是否用在导航栏')->default(1);
	        $table->string('meta_title', 255)->comment('seo优化')->default('');
	        $table->string('meta_keyword', 255)->comment('seo优化')->default('');
	        $table->string('meta_description', 1024)->comment('seo优化')->default('');
	        $table->timestamps();
	        $table->index('sort_number');
	        $table->index('parent_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categories');
    }
}
